package com.szy.system.api.result;

/**
 * @author : zhenyun.su
 * @comment : 定义返回结果的工具
 * @since : 2020/7/7
 */

@Deprecated
public final class ResultUtils {
    /**
     * @comment : 返回结果
     */
    public static <T> Result<T> of(Integer code, String msg) {
        return new Result<T>(code, msg);
    }
    public static <T> Result<T> of(Boolean status, Integer code, String msg) {
        return new Result<T>(status, code, msg);
    }
    public static <T> Result<T> of(Boolean status, Integer code, String msg, T data) {
        return new Result<T>(status, code, msg, data);
    }
    /**
     * @comment : 返回成功
     */
    public static <T> Result<T> success() {
        return new Result<T>(ResultEnum.SUCCESS.getStatus(), ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMsg());
    }
    public static <T> Result<T> success(T data) {
        return new Result<T>(ResultEnum.SUCCESS.getStatus(), ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMsg(), data);
    }
    public static <T> Result<T> success(String msg, T data) {
        return new Result<T>(ResultEnum.SUCCESS.getStatus(), ResultEnum.SUCCESS.getCode(), msg, data);
    }
    public static <T> Result<T> success(Integer code, String msg, T data) {
        return new Result<T>(ResultEnum.SUCCESS.getStatus(), code, msg, data);
    }
    public static <T> Result<T> success(Integer code, String msg) {
        return new Result<T>(ResultEnum.SUCCESS.getStatus(), code, msg);
    }
    public static <T> Result<T> success_exist(T data) {
        return new Result<T>(ResultEnum.S_EXIST.getStatus(), ResultEnum.S_EXIST.getCode(), ResultEnum.S_EXIST.getMsg(), data);
    }
    public static <T> Result<T> success_not_exist(T data) {
        return new Result<T>(ResultEnum.S_NOT_EXIST.getStatus(), ResultEnum.S_NOT_EXIST.getCode(), ResultEnum.S_NOT_EXIST.getMsg(), data);
    }
    /**
     * @comment : 返回成功
     */
    public static <T> Result<T> failure() {
        return new Result<T>(ResultEnum.FAILURE.getStatus(), ResultEnum.FAILURE.getCode(), ResultEnum.FAILURE.getMsg());
    }
    public static <T> Result<T> failure(T data) {
        return new Result<T>(ResultEnum.FAILURE.getStatus(), ResultEnum.FAILURE.getCode(), ResultEnum.FAILURE.getMsg(), data);
    }
    public static <T> Result<T> failure(String msg, T data) {
        return new Result<T>(ResultEnum.FAILURE.getStatus(), ResultEnum.FAILURE.getCode(), msg, data);
    }
    public static <T> Result<T> failure(Integer code, String msg, T data) {
        return new Result<T>(ResultEnum.FAILURE.getStatus(), code, msg, data);
    }
    public static <T> Result<T> failure(Integer code, String msg) {
        return new Result<T>(ResultEnum.FAILURE.getStatus(), code, msg);
    }
    public static <T> Result<T> failure_exist(T data) {
        return new Result<T>(ResultEnum.F_EXIST.getStatus(), ResultEnum.F_EXIST.getCode(), ResultEnum.F_EXIST.getMsg(), data);
    }
    public static <T> Result<T> failure_not_exist(T data) {
        return new Result<T>(ResultEnum.F_NOT_EXIST.getStatus(), ResultEnum.F_NOT_EXIST.getCode(), ResultEnum.F_NOT_EXIST.getMsg(), data);
    }
    public static <T> Result<T> failure_net_retry(T data) {
        return new Result<T>(ResultEnum.NET_RETRY.getStatus(), ResultEnum.NET_RETRY.getCode(), ResultEnum.NET_RETRY.getMsg(), data);
    }
    public static <T> Result<T> failure_un_known(String msg, T data) {
        return new Result<T>(ResultEnum.UN_KNOWN.getStatus(), ResultEnum.UN_KNOWN.getCode(), msg, data);
    }

}
